package com.itheima.tliasproject.service.impi;


import com.itheima.tliasproject.mapper.DeptMapper;
import com.itheima.tliasproject.pojo.Dept;
import com.itheima.tliasproject.service.Deptservice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class DeptServiceImpI implements Deptservice {

    @Autowired
  private DeptMapper deptMapper;
    @Override
    public List<Dept> List() {
        return deptMapper.List();
    }

    @Override
    public void delete(Integer id) {
        deptMapper.delete(id);
    }

    @Override
    public void Insert(Dept dept) {
        dept.setCreateTime(LocalDateTime.now());
        dept.setUpdateTime(LocalDateTime.now());
        deptMapper.Insert(dept);
    }

    @Override
    public Dept GetById(Integer id) {
       return deptMapper.GetById(id);
    }

    @Override
    public void Updata(Dept dept) {
        dept.setCreateTime(LocalDateTime.now());
        dept.setUpdateTime(LocalDateTime.now());
       deptMapper.Updata(dept);
    }
}
